<template>
  <div class="dashboard-container">
    <div class="app-container">
      <!-- 自定义组件，标题 -->
      <PageTitle :show-before="true">
        <template v-slot:before>
          <h2>投诉客服</h2>
        </template>
      </PageTitle>
      <el-row :gutter="10">
        <!-- <el-col :span="6"></el-col> -->
        <el-select placeholder="不限处理状态">
          <el-option
            v-for="item in handleStatus"
            :key="item.id"
            :label="item.name"
            :value="item.id"
          >
          </el-option>
        </el-select>
      </el-row>
      <!-- 数据表 -->
      <el-table
        v-loading="downloadLoading"
        ooltip-effect="dark"
        :data="list"
        max-height="500px"
        style="margin-top: 20px"
        @selection-change="handleSelectionChange"
      >
        <el-table-column type="selection" width="55" fixed />
        <el-table-column
          label="处理情况"
          align="center"
          width="width"
          prop="id"
          fixed
        >
          <template slot-scope="scope">
            <el-tag :type="scope.row.status ? 'success' : 'danger'">{{
              scope.row.status ? "已处理" : "未处理"
            }}</el-tag>
          </template>
        </el-table-column>
        <el-table-column label="客服" align="center" prop="name" fixed />
        <el-table-column
          label="内容"
          align="center"
          prop="content"
          width="130"
          fixed
        />
        <el-table-column
          label="投诉人"
          align="center"
          prop="school"
          width="180"
        >
          <template slot-scope="scope">
            {{ scope.row.mobile }} [ uid : {{ scope.row.uid }}]
          </template>
        </el-table-column>
        <el-table-column label="投诉时间" align="center" prop="addtime">
        </el-table-column>

        <el-table-column
          :label="$t('table.actions')"
          width="150"
          align="center"
          fixed="right"
        >
          <template>
            <el-button type="danger" size="mini" @click="delBtn"
              >删除</el-button
            >
          </template>
        </el-table-column>
      </el-table>
      <el-row :gutter="10" style="margin-top: 20px">
        <el-col :span="8">
          <el-button type="primary" size="small" @click="handleDialog = true"
            >处理</el-button
          >
          <el-button type="danger" size="small" @click="delBtn">删除</el-button>
        </el-col>
        <el-col :span="16">
          <el-pagination
            background
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange"
            :current-page="currentPage4"
            :page-sizes="[10, 20, 50, 100]"
            :page-size="10"
            layout="total, sizes, prev, pager, next, jumper"
            :total="255"
            style="text-align: right"
          >
          </el-pagination>
        </el-col>
      </el-row>
    </div>
    <el-dialog
      title="将所选信息设置为"
      :visible.sync="handleDialog"
      width="25%"
    >
      <el-form ref="form" :model="form" label-width="80px">
        <el-form-item label="处理情况">
          <el-radio v-model="radio" label="未处理"></el-radio>
          <el-radio v-model="radio" label="已处理"></el-radio>
        </el-form-item>
        <el-row :gutter="10" type="flex" justify="end">
          <el-button @click="handleDialog = false">取消</el-button>
          <el-button type="primary">确定</el-button>
        </el-row>
      </el-form>
    </el-dialog>
  </div>
</template>

<script>
export default {
  data() {
    return {
      handleDialog: false,
      list: [
        {
          id: 5,
          uid: 1622,
          cs_id: 1,
          content: "如何发布人事招考公告",
          addtime: 1718327407,
          status: 0,
          mobile: "17816633460",
          name: "暂未分配客服",
          username: null,
        },
        {
          id: 4,
          uid: 378,
          cs_id: 1,
          content: "如何修改公司名称?",
          addtime: 1712225208,
          status: 0,
          mobile: "18969891055",
          name: "暂未分配客服",
          username: null,
        },
        {
          id: 3,
          uid: 378,
          cs_id: 1,
          content: "企业如何进行重新认证?",
          addtime: 1711956964,
          status: 0,
          mobile: "18969891055",
          name: "暂未分配客服",
          username: null,
        },
        {
          id: 2,
          uid: 1228,
          cs_id: 1,
          content: "请问隐藏状态怎么去掉",
          addtime: 1711523252,
          status: 0,
          mobile: "18067318659",
          name: "暂未分配客服",
          username: null,
        },
        {
          id: 1,
          uid: 378,
          cs_id: 1,
          content: "企业名称如何修改？",
          addtime: 1710729486,
          status: 0,
          mobile: "18969891055",
          name: "暂未分配客服",
          username: null,
        },
      ],
      handleStatus: [
        { id: 1, name: "不限处理状态" },
        { id: 2, name: "已处理" },
        { id: 3, name: "未处理" },
      ],
    };
  },
  methods: {
    // 举报列表
    async reportList() {
      const res = await selReportListApi(this.reportQuery);
      console.log(res);
    },
    delBtn() {
      this.$confirm("此操作将永久删除该数据, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          this.$message({
            type: "success",
            message: "删除成功!",
          });
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消删除",
          });
        });
    },
  },
};
</script>

<style scoped></style>
